//
//  SAPThreePicTableViewCell.m
//  CarsHome
//
//  Created by dapeng on 15/12/1.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "SAPThreePicTableViewCell.h"
#import "Theme-PrefixHeader.pch"
@implementation SAPThreePicTableViewCell
- (void)dealloc {
    [_firstImage release];
    [_secondImage release];
    [_thirdImage release];
    [_topLabel release];
    [_footLabel release];
    [_commentLabel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.secondImage = [[UIImageView alloc] init];
        self.topLabel = [[UILabel alloc] init];
        self.footLabel = [[UILabel alloc] init];
        self.commentLabel = [[UILabel alloc] init];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
        [_secondImage release];
        [self addSubview:self.secondImage];
        [self addSubview:self.topLabel];
        [self addSubview:self.footLabel];
        [self addSubview:self.commentLabel];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
        [_secondImage release];
        for (int i = 0; i < 3; i++) {
            
        UIImageView *secondImage = [[UIImageView alloc] init];
        secondImage.tag = 100 + i;
        [self addSubview:secondImage];
        }
     
    }return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    for (int i = 0; i < 3; i++) {
        UIImageView *secondImage = (UIImageView *)[self viewWithTag:100 + i];
        secondImage.frame = CGRectMake((SCREEN_SIZE.width - 10) / 3 * i + 10, 30, (SCREEN_SIZE.width - 40) / 3, 80);
    }
    self.topLabel.frame = CGRectMake(10, 10, SCREEN_SIZE.width, 20);
    self.footLabel.frame = CGRectMake(10, 120, 100, 15);
    self.commentLabel.frame = CGRectMake(SCREEN_SIZE.width - 80, 120, 80, 15);
}
- (void)setTwoModel2:(recommentTwoModel *)twoModel2 {
    if (_twoModel2 != twoModel2) {
        [_twoModel2 release];
        _twoModel2 = [twoModel2 retain];
    
    }for (int i = 0; i < 3; i++) {
        NSArray *arrray = [NSArray arrayWithObjects:[UIImage imageNamed:@"threePic1.jpg"], [UIImage imageNamed:@"threePic2.jpg"], [UIImage imageNamed:@"threePic3.jpg"], nil];
            UIImageView *secondImages = (UIImageView *)[self viewWithTag:100 + i];
        secondImages.image = arrray[i];
    }
    self.topLabel.text = twoModel2.title;
    self.footLabel.text = twoModel2.time;
    self.commentLabel.text = [NSString stringWithFormat:@"%@图片", twoModel2.replycount];
    
    _footLabel.font = [UIFont systemFontOfSize:14];
    _commentLabel.font = [UIFont systemFontOfSize:14];
    _commentLabel.textAlignment = NSTextAlignmentRight;
    _footLabel.textColor = [UIColor grayColor];
    _commentLabel.textColor = [UIColor grayColor];
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [user objectForKey:@"nightModel"];
    
    if (!(passWord == nil) && [passWord isEqualToString:@"day"]) {
        self.backgroundColor = [UIColor colorWithWhite:0.126 alpha:1.000];
        self.topLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.footLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.commentLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        
    }else{
        self.topLabel.textColor = [UIColor blackColor];
        self.backgroundColor = [UIColor whiteColor];
        
    }
}











- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
